GtkOverlay: Don't allocate child except in size_allocate
authorAlexander Larsson <alexl@redhat.com>
Thu, 28 Mar 2013 11:10:09 +0000 (12:10 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 28 Mar 2013 12:32:06 +0000 (13:32 +0100)
commit785a916267c940a3cf67cf4986d2ff4469ff87e5
treefbea6522f4fa3847021ca7032a5616581fc969da
parent6f607fc8b4cd051e5134b59768b43b9c1c342366
GtkOverlay: Don't allocate child except in size_allocate

We were calling gtk_overlay_child_allocate() both in realize
and in add as we wanted to create and position the child windows
for the widgets. However, this call also actually called
gtk_widget_size_allocate() on the child, which it shouldn't. In some
cases the overlay is realized before being allocated, and thus it
will allocate the child at 0x0 which is an invalid size for it to be in.
In particular, if the child has margins set this will result in negative
allocations and warnings.

This fix splits out the allocation computation so that
gtk_overlay_create_child_window can use it without callers
having to call gtk_overlay_child_allocate() to move the windows.

https://bugzilla.gnome.org/show_bug.cgi?id=696623
gtk/gtkoverlay.c